//Mon 21 Dec 2009 12:51:30 AM CST 
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class StreetWalking
{
public:
	long long minTime(int x, int y, int WalkTime, int SneakTime)
	{
		long long ret;
		long long X =  x;
		long long Y =  y;
		long long walkTime = WalkTime;
		long long sneakTime = SneakTime;
		if(X < Y) swap(X, Y);
		if(sneakTime > 2*walkTime) 
		{
			ret = (X+Y)*walkTime;
			cout << ret << endl;
		}
		else if(sneakTime > walkTime) 
		{
			ret = Y*sneakTime + (X-Y)*walkTime;
			cout << ret << endl;
		}
		else if((X-Y)%2==0) 
		{
			ret = X*sneakTime;
			cout << ret << endl;
		}
		else 
		{	
			ret = (X-1)*sneakTime + walkTime;
			cout << ret << endl;
		}
		return ret;
	}
	long long pathcost(long long x, long long y, long long walkTime, long long sneakTime)
	{
		if(x == 0 && y == 0) return 0;
		if(x == 0) return min(sneakTime+pathcost(x+1,y-1,walkTime,sneakTime), walkTime+pathcost(x,y-1,walkTime,sneakTime));
		if(y == 0) return min(sneakTime+pathcost(x-1,y+1,walkTime,sneakTime), walkTime+pathcost(x-1,y,walkTime,sneakTime));
		long long ret = (x+y)*max(walkTime, sneakTime);
		ret = min(ret, sneakTime+pathcost(x-1,y+1,walkTime,sneakTime));
		ret = min(ret, walkTime+pathcost(x-1,y,walkTime,sneakTime));
		ret = min(ret, sneakTime+pathcost(x-1,y-1,walkTime,sneakTime));
		ret = min(ret, walkTime+pathcost(x,y-1,walkTime,sneakTime));
		return ret;
	}
};
